/**
 * 保存页面滚动位置
 * @type {{onScrollPositionHandle(): void}}
 */
const methods = {
  onScrollPositionHandle(e) {
    this.scroll = e.currentTarget.scrollTop;
  },
  setScrollPosition() {
    if (this.scroll > 0) {
      this.pageScrollEl.scrollTop = this.scroll;
      this.scroll = 0;
    }
  }
};

const beforeDestroy = function () {
  this.pageScrollEl.removeEventListener('scroll', this.onScrollPositionHandle)
};

const mounted = function () {
	if(document.querySelector('.abox')){
		this.pageScrollEl = document.querySelector('.abox')
	}
};

const activated = function () {
  this.pageScrollEl.addEventListener('scroll', this.onScrollPositionHandle, true);
  this.setScrollPosition();
};

const data = function () {
  return {}
};
export default {
  methods,
  data,
  activated,
  mounted,
  beforeDestroy
}